public class Test {
    public static void arrary(int[] nums){
        int target = 9;
        for (int i = 0; i < nums.length-1 ; i++) {
            for (int j = i+1; j < nums.length ; j++) {
                if (nums[i] ==target - nums[j]) {
                    System.out.println(i+"  "+j);

                }

            }

        }

    }

    public static void main(String[] args) {
        int[] nums = new int[]{1,2,3,4,5,6,7,8};
        arrary(nums);
    }
}
